package com.twu.biblioteca;

import command.Command;
import command.CommandParser;
import util.CommandsStorage;
import util.IO;

public class Biblioteca {
    public static final String WELCOME_MESSAGE = "Welcome!\n";
    public static final String MENU_LIST = "login + libraryNumber + password : customer login.(please login first,libraryNumber can be 111-1111,and password is 123)\n" +
            "viewBooks : view all the books.\n" +
            "reserve + bookId : reserve a book for collection.(require customer login)\n" +
            "check : check membership details.\n" +
            "viewMovies : view all the movies.\n" +
            "exit : exit the Biblioteca system.\n";

    public void init() {
        CommandsStorage.parseCommands();
        welcomeMessage();
        menuListMessage();
    }

    public void menuListMessage() {
        IO.output(MENU_LIST);
    }

    public void welcomeMessage() {
        IO.output(WELCOME_MESSAGE);
    }

    public void run() {
        String cmdStr = IO.readLine();
        Command cmd = CommandParser.parser(cmdStr);
        cmd.run();
    }

    public static void main(String[] args) {
        Biblioteca biblioteca = new Biblioteca();
        biblioteca.init();

        while (true) {
            biblioteca.run();
        }
    }
}
